home *** CD-ROM | disk | FTP | other *** search
/ Menu Planner / Menu Planner (Ohio Distinctive Software).ISO / pc / mp.dir / 00141_SetArrays.ls < prev    next >
Encoding:
Text File  |  1995-11-07  |  4.8 KB  |  185 lines

  1. on SetPDCFlags theFlag, theValue
  2.   global calcdata, oldest, youngest, gDirty
  3.   set gDirty to 1
  4.   validatePDCScreen()
  5.   setaProp(calcdata, theFlag, theValue)
  6.   if theFlag = #none then
  7.     setaProp(calcdata, #diabetes, 0)
  8.     setaProp(calcdata, #heart, 0)
  9.     setaProp(calcdata, #preg, 0)
  10.     setaProp(calcdata, #hypr, 0)
  11.     setaProp(calcdata, #vegt, 0)
  12.     setaProp(calcdata, #under_19, 0)
  13.     setaProp(calcdata, #low_fat, 0)
  14.   else
  15.     put "something has been checked"
  16.     if theFlag = #vegt then
  17.       put "veg checked"
  18.       if getaProp(calcdata, #brk_meat) then
  19.         put "break meat checked"
  20.         set x to 12
  21.         set notDone to 1
  22.         repeat while notDone
  23.           if getAt(calcdata, x) = 0 then
  24.             setAt(calcdata, x, 1)
  25.             if oldest = #brk_meat then
  26.               set oldest to getPropAt(calcdata, x)
  27.             else
  28.               if youngest = #brk_meat then
  29.                 set youngest to getPropAt(calcdata, x)
  30.               end if
  31.             end if
  32.             set notDone to 0
  33.             next repeat
  34.           end if
  35.           set x to x + 1
  36.         end repeat
  37.         setaProp(calcdata, #brk_meat, 0)
  38.       end if
  39.       if getaProp(calcdata, #lun_meat) then
  40.         setaProp(calcdata, #lun_meat, 0)
  41.         setaProp(calcdata, #lun_pasta, 1)
  42.       end if
  43.       setaProp(calcdata, #din_meat, 0)
  44.       setaProp(calcdata, #din_pasta, 1)
  45.     else
  46.       if theFlag = #low_fat then
  47.         if getaProp(calcdata, #brk_meat) then
  48.           set x to 12
  49.           set notDone to 1
  50.           repeat while notDone
  51.             if getAt(calcdata, x) = 0 then
  52.               setAt(calcdata, x, 1)
  53.               if oldest = #brk_meat then
  54.                 set oldest to getPropAt(calcdata, x)
  55.               else
  56.                 if youngest = #brk_meat then
  57.                   set youngest to getPropAt(calcdata, x)
  58.                 end if
  59.               end if
  60.               set notDone to 0
  61.               next repeat
  62.             end if
  63.             set x to x + 1
  64.           end repeat
  65.           setaProp(calcdata, #brk_meat, 0)
  66.         end if
  67.       end if
  68.     end if
  69.     setaProp(calcdata, #none, 0)
  70.   end if
  71.   setPDCNoFatFromArray()
  72.   updateStage()
  73. end
  74.  
  75. on setFatPercentFlag theFlag, theValue
  76.   global calcdata, gDirty
  77.   set gDirty to 1
  78.   validatePDCScreen()
  79.   setaProp(calcdata, theFlag, theValue)
  80.   setFatPercentFromArray()
  81.   updateStage()
  82. end
  83.  
  84. on setLunchGroup1Flags theFlag, theValue
  85.   global calcdata, gDirty
  86.   set gDirty to 1
  87.   setaProp(calcdata, #lun_meat, 0)
  88.   setaProp(calcdata, #lun_pasta, 0)
  89.   setaProp(calcdata, #lun_sand, 0)
  90.   setaProp(calcdata, theFlag, theValue)
  91.   setLunchGroup1FromArray()
  92.   updateStage()
  93. end
  94.  
  95. on setLunchGroup2Flags theFlag, theValue
  96.   global calcdata, gDirty
  97.   set gDirty to 1
  98.   setaProp(calcdata, #lun_soup, 0)
  99.   setaProp(calcdata, #lun_salad, 0)
  100.   setaProp(calcdata, theFlag, theValue)
  101.   setLunchGroup2FromArray()
  102.   updateStage()
  103. end
  104.  
  105. on setLunchGroup3Flags theFlag, theValue
  106.   global calcdata, gDirty
  107.   set gDirty to 1
  108.   setaProp(calcdata, #lun_fruit, 0)
  109.   setaProp(calcdata, #lun_juice, 0)
  110.   setaProp(calcdata, theFlag, theValue)
  111.   setLunchGroup3FromArray()
  112.   updateStage()
  113. end
  114.  
  115. on setLunchGroup4Flags theFlag, theValue
  116.   global calcdata, gDirty
  117.   set gDirty to 1
  118.   setaProp(calcdata, #lun_milk, 0)
  119.   setaProp(calcdata, #lun_cheese, 0)
  120.   setaProp(calcdata, theFlag, theValue)
  121.   setLunchGroup4FromArray()
  122.   updateStage()
  123. end
  124.  
  125. on setBreakfastGroup1Flags theFlag, theValue
  126.   global calcdata, oldest, youngest, gDirty
  127.   set gDirty to 1
  128.   if theValue = 1 then
  129.     setaProp(calcdata, oldest, 0)
  130.     set oldest to youngest
  131.     set youngest to theFlag
  132.   end if
  133.   setaProp(calcdata, theFlag, theValue)
  134.   setBreakfastGroup1FromArray()
  135.   updateStage()
  136. end
  137.  
  138. on setBreakfastGroup2Flags theFlag, theValue
  139.   global calcdata, gDirty
  140.   set gDirty to 1
  141.   setaProp(calcdata, #brk_fruit, 0)
  142.   setaProp(calcdata, #brk_juice, 0)
  143.   setaProp(calcdata, theFlag, theValue)
  144.   setBreakfastGroup2FromArray()
  145.   updateStage()
  146. end
  147.  
  148. on SetDinnerGroup1Flags theFlag, theValue
  149.   global calcdata, gDirty
  150.   set gDirty to 1
  151.   setaProp(calcdata, #din_meat, 0)
  152.   setaProp(calcdata, #din_pasta, 0)
  153.   setaProp(calcdata, theFlag, theValue)
  154.   setDinnerGroup1FromArray()
  155.   updateStage()
  156. end
  157.  
  158. on SetDinnerGroup2Flags theFlag, theValue
  159.   global calcdata, gDirty
  160.   set gDirty to 1
  161.   setaProp(calcdata, #din_bread, 0)
  162.   setaProp(calcdata, #din_potatoes, 0)
  163.   setaProp(calcdata, theFlag, theValue)
  164.   setDinnerGroup2FromArray()
  165.   updateStage()
  166. end
  167.  
  168. on SetDinnerGroup3Flags theFlag, theValue
  169.   global calcdata, gDirty
  170.   set gDirty to 1
  171.   setaProp(calcdata, #din_soup, 0)
  172.   setaProp(calcdata, #din_salad, 0)
  173.   setaProp(calcdata, theFlag, theValue)
  174.   setDinnerGroup3FromArray()
  175.   updateStage()
  176. end
  177.  
  178. on SetDinnerGroup4Flags theFlag, theValue
  179.   global calcdata, gDirty
  180.   set gDirty to 1
  181.   setaProp(calcdata, theFlag, theValue)
  182.   setDinnerGroup4FromArray()
  183.   updateStage()
  184. end
  185.